package com.cctc.rds.nrpc.core.protocol.codec;

import com.cctc.rds.nrpc.core.protocol.message.Message;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.ByteToMessageDecoder;

import java.util.List;

public class MessageDecode extends ByteToMessageDecoder {
    @Override
    protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception {
        Message message = MessageCodecManager.decode(in);
        if (message != null) out.add(message);
    }
}
